// 滑动窗口思想， 维护两个指针

let s = 'dklfjasdlkfjdkjfd'
function handle(s) {
    let map = new Map()
    let l = 0
    let num = 0
    for(let i in s) {
        if (map.has(s[i]) && map.get(s[i]) > l) {
            l = map.get(s[i]) + 1
        } 
        num = Math.max(num, i - l + 1)
        map.set(s[i], i)
        
    }

    return num
}
let res = handle(s)
console.log(res)